package com.blb.demo4;

import java.util.concurrent.atomic.AtomicLong;

public class AutomixDemo {

    public static long count = 0;

    public static AtomicLong count2=new AtomicLong(0);


    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 10000; i++) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                        count++;
                        count2.getAndIncrement();
                }
            }).start();
        }
        Thread.sleep(1000);
        System.out.println("count= " + count);
        System.out.println("count2= " + count2);
    }


}
